#include <iostream>
using namespace std;

/*
    友元类：把整个类声明成另一个类的友元
        语法：friend class 类名;
        在Alipay类中声明Person是友元类：friend class Person; 
*/

class Person;

class Alipay
{
public:
    Alipay(string accountnum, string password, double money)
    {
        this->accountnum = accountnum;
        this->password = password;
        this->money = money;
    }
    friend class Person;

private:
    string accountnum;
    string password;
    double money;
};

class Person
{
public:
    Person(string name)
    {
        this->name = name;
    }
    void showAlipay(Alipay &alipay)
    {
        cout << "账号:" << alipay.accountnum << endl;
        cout << "密码:" << alipay.password << endl;
        cout << "余额:" << alipay.money << endl;
        cout << "======================================" << endl;
    }
    void updateAlipay(Alipay &alipay,string _num, string _password,double _money)
    {
        alipay.accountnum = _num;
        alipay.password = _password;
        alipay.money = _money;
    }
private:
    string name;
};


int main()
{
    Alipay alipay("李四","123456",1000.0);
    Person person("张三");
    person.showAlipay(alipay);
    person.updateAlipay(alipay,"王五","654321",500);
    person.showAlipay(alipay);



    return 0;
}